﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

using Microsoft.Xna.Framework.Graphics;

namespace ScytheEngine
{
    public class CameraManager
	{
		#region Data Members

		private static Dictionary<string,Camera> m_Cameras = new Dictionary<string,Camera>();
		private static Camera m_ActiveCamera;

		#endregion

		#region Methods

		public static void AddCamera(Camera newCamera, string cameraLabel)
		{
			m_Cameras.Add( cameraLabel, newCamera );
		}

		public static void SetActiveCamera(string cameraLabel)
		{
			if(m_Cameras.ContainsKey(cameraLabel))
			{
				m_ActiveCamera = m_Cameras[cameraLabel];
			}
			else
			{
				Debug.Assert( false, "Active camera could not be set!", "There is no camera with a camera label of: " + cameraLabel );
			}
		}

		public static void UpdateViewports(Viewport newViewport)
		{
			foreach(Camera camera in m_Cameras.Values)
			{
				camera.SetViewport( newViewport );
			}
		}

		#endregion

		#region Properties

		public static Camera ActiveCamera
		{
			get { return m_ActiveCamera; }
		}

		#endregion
	}
}
